package net.demo.demo3;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public class TcpServer {
    public static void main(String[] args) throws IOException {
        //创建服务端的对象
        ServerSocket ss = new ServerSocket(10001);

            //等待数据
            Socket accept = ss.accept();
            //使用高速读写缓冲流,一层一层嵌套进去
            BufferedReader bfd=new BufferedReader(new InputStreamReader(accept.getInputStream()));
            //显示数据
            int b;
            while ((b=bfd.read())!=-1){
                System.out.print((char) b);
            }

        bfd.close();
            ss.close();

    }
}
